<template>
  <!-- Nav Bar -->
    <van-nav-bar :title="navBarTitle" left-arrow>
      <template #left>
        <van-icon name="search" size="26" />
      </template>
      <template #right>
        <div class="right-login">
          <router-link to>登录</router-link>|
          <router-link to>注册</router-link>
        </div>
      </template>
    </van-nav-bar>
</template>

<script>
import { GetAddr } from "@/request/api";
export default {
  data() {
    return {
      navBarTitle: ""
    };
  },
  // 创建初始化
  created() {
    GetAddr("23.128225,113.289752").then(res => {
      this.navBarTitle = res.data.name;
    });
  }
}
</script>

<style lang="less">
@font-size: 33px;

#app .van-nav-bar {
  height: 1.2rem;
  line-height: 1.2rem;
  text-align: center;
  background-color: #3792e5;

  .van-nav-bar__title {
    color: #fff;
    font-size: @font-size;
  }

  .right-login {
    font-size: @font-size;
    color: #fff;
    .router-link-exact-active.router-link-active {
      font-size: @font-size;
      color: #fff;
    }
  }
}
#app .van-nav-bar__left {
  height: 1.2rem;
  line-height: 1.2rem;
  i {
    color: #fff;
  }
}

</style>